package com.ns.scs.task.init;

import com.ns.scs.task.service.IScheduledTaskService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 项目启动时初始化定时任务
 *
 * @author liao.wei
 * @since 2024/11/11
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class ScheduledTaskRunner implements ApplicationRunner {

    private final IScheduledTaskService scheduledTaskService;

    @Override
    public void run(ApplicationArguments args) {
        scheduledTaskService.initTask();
    }
}